package com.aspose.cells;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

class zps {
   Workbook a;
   zpn b = null;
   ArrayList c = new ArrayList();
   boolean d = false;
   boolean e = false;
   String f = null;
   ArrayList g = new ArrayList();
   ArrayList h = new ArrayList();
   zpd i = null;
   ArrayList j = new ArrayList();
   ArrayList k = new ArrayList();
   zpc l = new zpc();
   boolean m = false;
   String n;

   zps(Workbook var1) {
      this.a = var1;
      this.i = new zpd(this);
   }

   void a() throws Exception {
      for(int var1 = 0; var1 < this.h.size(); ++var1) {
         String var2 = (String)this.h.get(var1);
         if (!this.d(var2) && !this.e(var2)) {
            this.a(var2);
         }
      }

   }

   private boolean d(String var1) throws Exception {
      var1 = com.aspose.cells.b.a.d.zk.b(var1);

      for(int var2 = 0; var2 < this.k.size(); ++var2) {
         zpk var3 = (zpk)this.k.get(var2);

         for(int var4 = 0; var4 < var3.d.size(); ++var4) {
            zqe var5 = (zqe)var3.d.get(var4);
            String var6 = com.aspose.cells.b.a.d.zk.b(var5.e);
            if (com.aspose.cells.b.a.zv.b(var1, var6)) {
               return true;
            }
         }
      }

      return false;
   }

   private boolean a(ShapeCollection var1, String var2) throws Exception {
      if (var1 != null) {
         ArrayList var3 = var1.a();
         if (var3 != null) {
            for(int var4 = 0; var4 < var3.size(); ++var4) {
               zqe var5 = (zqe)var3.get(var4);
               String var6 = com.aspose.cells.b.a.d.zk.b(var5.e);
               if (com.aspose.cells.b.a.zv.b(var2, var6)) {
                  return true;
               }
            }
         }
      }

      return false;
   }

   private boolean e(String var1) throws Exception {
      var1 = com.aspose.cells.b.a.d.zk.b(var1);
      WorksheetCollection var2 = this.a.getWorksheets();

      for(int var3 = 0; var3 < var2.getCount(); ++var3) {
         Worksheet var4 = var2.get(var3);
         if (this.a(var4.t(), var1)) {
            return true;
         }

         if (var4.getCharts() != null) {
            for(int var5 = 0; var5 < var4.getCharts().getCount(); ++var5) {
               Chart var6 = var4.getCharts().get(0);
               if (this.a(var6.l(), var1)) {
                  return true;
               }
            }
         }

         if (var4.g != null) {
            Iterator var8 = var4.g.q.iterator();

            while(var8.hasNext()) {
               zqe var9 = (zqe)var8.next();
               String var7 = com.aspose.cells.b.a.d.zk.b(var9.e);
               if (com.aspose.cells.b.a.zv.b(var1, var7)) {
                  return true;
               }
            }
         }
      }

      return false;
   }

   void a(String var1) throws Exception {
      zpk var2 = null;

      for(int var3 = 0; var3 < this.k.size(); ++var3) {
         zpk var4 = (zpk)this.k.get(var3);
         if (com.aspose.cells.b.a.zv.b(var4.b, var1) || com.aspose.cells.b.a.zv.b(com.aspose.cells.b.a.d.zk.b(var4.b), var1)) {
            var2 = var4;
            break;
         }
      }

      if (var2 != null) {
         this.k.remove(var2);
      }

   }

   void a(Collection var1) throws Exception {
      if (var1 != null) {
         Iterator var2 = var1.iterator();

         while(var2.hasNext()) {
            zqe var3 = (zqe)var2.next();
            String var4 = com.aspose.cells.b.a.d.zk.b(var3.e);
            String var5 = zase.aj(var3.e);
            ArrayList var6 = this.k;

            for(int var7 = 0; var7 < var6.size(); ++var7) {
               zpk var8 = (zpk)var6.get(var7);
               String var9 = com.aspose.cells.b.a.d.zk.b(var8.b);
               String var10 = zase.aj(var8.b);
               if (com.aspose.cells.b.a.zv.b(var4, var9) && com.aspose.cells.b.a.zv.b(var5, var10)) {
                  String var11 = com.aspose.cells.b.a.d.zk.b(var8.c);
                  var3.e = zase.a(var3.e, var11);
               }
            }
         }

      }
   }

   boolean b(String var1) {
      int var2 = this.g.size();

      for(int var3 = 0; var3 < var2; ++var3) {
         String var4 = (String)this.g.get(var3);
         if (com.aspose.cells.b.a.zv.b(var4, var1)) {
            return true;
         }
      }

      return false;
   }

   znt c(String var1) {
      for(int var2 = 0; var2 < this.c.size(); ++var2) {
         znt var3 = (znt)this.c.get(var2);
         if (com.aspose.cells.b.a.zv.b(var3.d, var1)) {
            return var3;
         }
      }

      return null;
   }

   void b() {
      ArrayList var1 = new ArrayList();

      int var2;
      for(var2 = 0; var2 < this.c.size(); ++var2) {
         znt var3 = (znt)this.c.get(var2);
         if ("application/vnd.openxmlformats-package.digital-signature-origin".equals(var3.d) || "application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml".equals(var3.d)) {
            com.aspose.cells.b.a.a.ze.a(var1, (Object)var3);
         }
      }

      Iterator var4 = var1.iterator();

      Object var5;
      while(var4.hasNext()) {
         var5 = var4.next();
         this.c.remove(var5);
      }

      var1.clear();

      for(var2 = 0; var2 < this.j.size(); ++var2) {
         zqe var6 = (zqe)this.j.get(var2);
         if ("http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin".equals(var6.d)) {
            com.aspose.cells.b.a.a.ze.a(var1, (Object)var6);
         }
      }

      var4 = var1.iterator();

      while(var4.hasNext()) {
         var5 = var4.next();
         this.j.remove(var5);
      }

      this.m = false;
   }
}
